import request from '@/utils/request'
import { downFile } from '@/utils/request'

/**
 * 用户优惠劵分页查询
 * @param {查询条件} data
 */
export function listLayUserCoupon(query) {
  return request({
    url: 'business/LayUserCoupon/list',
    method: 'get',
    params: query,
  })
}

/**
 * 新增用户优惠劵
 * @param data
 */
export function addLayUserCoupon(data) {
  return request({
    url: 'business/LayUserCoupon',
    method: 'post',
    data: data,
  })
}
/**
 * 修改用户优惠劵
 * @param data
 */
export function updateLayUserCoupon(data) {
  return request({
    url: 'business/LayUserCoupon',
    method: 'PUT',
    data: data,
  })
}
/**
 * 获取用户优惠劵详情
 * @param {Id}
 */
export function getLayUserCoupon(id) {
  return request({
    url: 'business/LayUserCoupon/' + id,
    method: 'get'
  })
}

/**
 * 删除用户优惠劵
 * @param {主键} pid
 */
export function delLayUserCoupon(pid) {
  return request({
    url: 'business/LayUserCoupon/delete/' + pid,
    method: 'POST'
  })
}
// 导出用户优惠劵
export async function exportLayUserCoupon(query) {
  await downFile('business/LayUserCoupon/export', { ...query })
}
